package org.etom.impl.ui.wizards;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.WizardExportResourcesPage;

/**
 * The abstract class initializes the GUI for the given wizard page.
 */
public abstract class AbstractUploadWizardPage extends WizardExportResourcesPage {

  private static final String PAGE_NAME = "UploadWizardPage1"; //$NON-NLS-1$
  
  protected Text fileNameTemplateText;
  
  protected AbstractUploadWizardPage(IStructuredSelection selection) {
    super(PAGE_NAME, selection);
  }

  @Override
  protected void createOptionsGroup(Composite parent) {
    //the option group is not used
  }

  @Override
  public void createControl(Composite parent) {
    super.createControl(parent);
    initPage();
  }
  
  @Override
  protected void createDestinationGroup(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    GridData layoutData = new GridData();
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.horizontalAlignment = SWT.FILL;
    composite.setLayoutData(layoutData);
    
    Label fileNameLabel = new Label(composite, SWT.NONE);
    fileNameLabel.setText(WizardsMessages.Upload_Wizard_Page_File_Name_Label);
    
    fileNameTemplateText = new Text(composite, SWT.BORDER);
    layoutData = new GridData();
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.horizontalAlignment = SWT.FILL;
    fileNameTemplateText.setLayoutData(layoutData);
  }
  
  private void initPage() {
    setDescription(WizardsMessages.Upload_Wizard_Page_Description);
    setTitle(WizardsMessages.Upload_Wizard_Page_Title);
  }
  
}
